package kuzha.ast;

public class CaseStatement extends BlockStatement {
	public final Expression cond;
	public final CaseElement[] pats;
	public final Statement _else;
	
	public CaseStatement(Expression cond, CaseElement[] pats, Statement _else) {
		if (cond == null || pats == null)
			throw new IllegalArgumentException();
		this.cond = cond;
		this.pats = pats.clone();
		this._else = _else;
	}
	
	@Override
	public void accept(AstVisitor visitor) {
		visitor.visit(this);
	}
	@Override
	public <A, R> R accept(AstVisitor2<A, R> visitor, A object) {
		return visitor.visit(this, object);
	}
	
	public CaseElement getElement(int i) {
		return pats[i];
	}
	public int getElementCount() {
		return pats.length;
	}
}
